import request from '@/utils/request/req';

// 验证信息数据类型定义
export interface AuthenticationInfo {
  id?: number;
  account: string;
  message: string;
  createBy?: string;
  createTime?: string;
  updateBy?: string;
  updateTime?: string;
}

// 分页查询参数类型
export interface AuthenticationQueryParams {
  account?: string;
  message?: string;
  current?: number;
  size?: number;
}

// 分页响应数据类型
export interface PageResult<T> {
  records: T[];
  total: number;
  size: number;
  current: number;
  pages: number;
}

// 查询验证信息列表
export function getAuthenticationList(params: AuthenticationQueryParams) {
  return request({
    url: '/msg/authentication/list',
    method: 'GET',
    params
  });
}

// 新增验证信息
export function addAuthentication(data: AuthenticationInfo) {
  return request({
    url: '/msg/authentication/add',
    method: 'POST',
    data
  });
}

// 修改验证信息
export function updateAuthentication(data: AuthenticationInfo & { id: number }) {
  return request({
    url: '/msg/authentication/update',
    method: 'POST',
    data
  });
}

// 删除验证信息
export function deleteAuthentication(data: { id: number; account: string }) {
  return request({
    url: `/msg/authentication/delete/${data.id}`,
    method: 'POST',
    data
  });
}
